import request from '@/utils/request'

/**
 * 生成跟踪号
 * @returns {Promise} - 返回生成的跟踪号
 */
export function generateTrackingNumber() {
    return request({
        url: '/delivery/outBoundOrder/generateTrackingNumber',
        method: 'post',
    });
}

/**
 * 查询出库订单列表
 * @param {Object} query - 查询参数，包括分页、筛选条件等
 * @returns {Promise} - 返回出库订单数据和分页信息
 */
export function listOutBoundOrder(query) {
    return request({
        url: '/delivery/outBoundOrder/list',
        method: 'get',
        params: query,
    });
}

/**
 * 新增出库订单
 * @param {Object} data - 出库订单信息
 * @returns {Promise} - 返回新增结果
 */
export function addOutBoundOrder(data) {
    return request({
        url: '/delivery/outBoundOrder/add',
        method: 'post',
        data,
    });
}

/**
 * 更新出库订单
 * @param {Object} data - 出库订单信息
 * @returns {Promise} - 返回更新结果
 */
export function updateOutBoundOrder(data) {
    return request({
        url: '/delivery/outBoundOrder/update',
        method: 'put',
        data,
    });
}

/**
 * 删除出库订单
 * @param {String} outId - 出库单号
 * @returns {Promise} - 返回删除结果
 */
export function deleteOutBoundOrder(outId) {
    return request({
        url: '/delivery/outBoundOrder/delete',
        method: 'delete',
        params: { outId },
    });
}

/**
 * 获取出库订单详情
 * @param {String} outId - 出库单号
 * @returns {Promise} - 返回出库单详情
 */
export function getOutBoundOrderDetail(outId) {
    return request({
        url: '/delivery/outBoundOrder/details',
        method: 'get',
        params: { outId },
    });
}
